Writing multiple lines in file handling